package com.zzj.hotel.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.zzj.hotel.core.entity.Room;
import com.zzj.hotel.dao.RoomDao;
import com.zzj.hotel.service.RoomService;

public class RoomServiceImpl implements RoomService {
	private RoomDao roomDao;
	public RoomDao getRoomDao() {
		return roomDao;
	}

	public void setRoomDao(RoomDao roomDao) {
		this.roomDao = roomDao;
	}

	public Room findById(String id) {
		Map<String, Object> queryMap = new HashMap<String, Object>();
		queryMap.put(Room.ROOMID, id);
		return roomDao.selectOne(queryMap);
	}

	public List<Room> findAll() {
		return roomDao.selectList(null);
	}

	public List<Room> findByType(int roomType) {
		Map<String, Object> queryMap = new HashMap<String, Object>();
		queryMap.put(Room.ROOMTYPE, roomType);
		return roomDao.selectList(queryMap);
	}

	public List<Room> findByStatus(int roomStatus) {
		Map<String, Object> queryMap = new HashMap<String, Object>();
		queryMap.put(Room.ROOMSTATUS, roomStatus);
		return roomDao.selectList(queryMap);
	}

	public List<Room> findByTypeStatus(int roomType, int roomStatus) {
		Map<String, Object> queryMap = new HashMap<String, Object>();
		queryMap.put(Room.ROOMSTATUS, roomStatus);
		queryMap.put(Room.ROOMTYPE, roomType);
		return roomDao.selectList(queryMap);
	}

	public void update(Room room) {
		roomDao.update(room);
	}

	public void insert(Room room) {
		roomDao.insert(room);

	}

	public void deleteById(String id) {
		Map<String, Object> queryMap = new HashMap<String, Object>();
		queryMap.put(Room.ROOMID, id);
		roomDao.delete(queryMap);
	}

}
